<?php
class register_model extends CI_Model {


	function register_user($email, $addr, $nickname, $pwd, $pic,$gender,$pn,$byear,$bmonth,$bday){
		$this->load->database();
		$hash_pwd = MD5($pwd);
		$bd = "$byear"."-"."$bmonth"."-"."$bday";
		$query = "insert into public.users values(?,?,?,?,?,?,?,?)";
		$this->db->query($query,array($email,$addr,$nickname,$hash_pwd,$pic,$pn,$gender,$bd));
	}
	function check_record($email){		
		$this->load->database();
		$query1 = "select email from users where email = ?";
		$result = $this->db->query($query1,array($email));
		if($result->num_rows() >0){
			return true;
		} else {
			return false;
		}
	}
}
?>